<?php
  //
  // Memorii Web API
  // api/login.php
  //
  // User login.
  //
  
  require_once('../script/db/db.php');
  require_once('../script/user/login.php');
  
  ob_start();
  
  // We get what we need
  if( isset($_POST['email']) && isset($_POST['password_md5']) ) {
    $email       	= $_POST['email'];
    $password_md5 = $_POST['password_md5'];
    
    $ret = mii_login($email, $password_md5);
    
    if( $ret==MII_API_LOGIN_SUCCESS ) {
    	echo 'SUCCESS';
    }
    elseif( $ret==MII_API_LOGIN_ERROR_ACTIVATION ) {
 			echo 'ERROR';
   	}
   	else {
	   	echo 'ERROR';
   	}
  }
 	ob_flush();
?>